package
{
	import flash.events.Event;
	
	import jiglib.physics.RigidBody;
	import jiglib.plugin.sandy3d.Sandy3DPhysics;
	
	import sandy.view.BasicView;

	public class TestClass extends BasicView {
		private var physics:Sandy3DPhysics;
		
		/**
		 * Initiate the physics engine, add the shpere and start rendering.
		 */
		public function TestClass() {
			// Initiate the BasicView
			super.init(400, 400);
			// Create an instance of the physics engine
			physics = new Sandy3DPhysics(scene, 1);
			// Create an object
			createSphere();
			// Start rendering
			render();
		}
		/**
		 * Create the sphere object and add it to the scene.
		 * The physics engine creates the rigid sphere object and the Sandy sphere.
		 * It also adds the Shape3D to rhe root grup of the scene
		 */
		private function createSphere():void
		{	
			var sphere:RigidBody = physics.createSphere("sphere", null, 20, 7, 5);
		}
		
		/**
		 * Overriding the simpleRender method to call the time step method of the rendering engine.
		 * @param	event	The ENTER_FRAME or timer event - the heart beat of Sandy
		 */
		override public function simpleRender( event:Event = null ):void {
			physics.step( );
			super.simpleRender( event );
		}
	}
}